package com.watson.spring.all.security.service.security;

import com.watson.spring.all.security.base.tool.Rdad;
import com.watson.spring.all.security.base.tool.ResponseUtil;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author watson
 * @date 2021/5/28 14:26
 * @Description: TODO
 **/
public class UnauthEntryPoint implements AuthenticationEntryPoint {
    @Override
    public void commence(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse,
                         AuthenticationException e) throws IOException, ServletException {
        ResponseUtil.out(httpServletResponse, Rdad.error());
    }
}
